﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;


namespace nadModel.pad
{
    public partial class BOMEntityProcess : AbstractEntityProcess
    {
        public string conection_addr = "http://nad.nadfinlo.com.cn/nad/";
        public BOMEntity[] FindByParameter(string company, string part, string rev)
        {
            string sql = "  select * from " + BOMEntity.DB_TABLES + " where " + BOMEntity.LASTPART + " ='" + part + "' and " + BOMEntity.COMPANY + "='" + company + "' and " + BOMEntity.REV + "='" + rev + "'";

            BOMEntity[] ents = (BOMEntity[])FindBySql(sql, conection_addr);
            return ents;
        }

        public DataTable FindRevByPart(string partnum, string company)
        {
            string sql = " select  revisionnum from erp.PartRev with(nolock) WHERE partnum='" + partnum + "' and company='" + company + "'";
            return (DataTable)ExecuteReader(sql, conection_addr);
        }

        public BOMEntity[] FindJobMtlByJobNum(string partnum, string jobnum, string company)
        {
            string sql = " select  * from mold_part_view  WHERE LastPart='" + partnum + "' and company='" + company + "' and JobNum='" + jobnum + "' ";
            BOMEntity[] ents = (BOMEntity[])FindBySql(sql, conection_addr);
            return ents;
        }
    }
}
